3.376 \(\int (a+b \tan ^3(c+d x))^2 \, dx\)

Optimal. Leaf size=89 \[ x \left (a^2-b^2\right )+\frac {a b \tan ^2(c+d x)}{d}+\frac {2 a b \log (\cos (c+d x))}{d}+\frac {b^2 \tan ^5(c+d x)}{5 d}-\frac {b^2 \tan ^3(c+d x)}{3 d}+\frac {b^2 \tan (c+d x)}{d} \]

[Out]

(a^2-b^2)*x+2*a*b*ln(cos(d*x+c))/d+b^2*tan(d*x+c)/d+a*b*tan(d*x+c)^2/d-1/3*b^2*tan(d*x+c)^3/d+1/5*b^2*tan(d*x+
c)^5/d

________________________________________________________________________________________

Rubi [A]  time = 0.06, antiderivative size = 89, normalized size of antiderivative = 1.00, number of steps used = 6, number of rules used = 5, integrand size = 14, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.357, Rules used = {3661, 1810, 635, 203, 260} \[ x \left (a^2-b^2\right )+\frac {a b \tan ^2(c+d x)}{d}+\frac {2 a b \log (\cos (c+d x))}{d}+\frac {b^2 \tan ^5(c+d x)}{5 d}-\frac {b^2 \tan ^3(c+d x)}{3 d}+\frac {b^2 \tan (c+d x)}{d} \]

Antiderivative was successfully verified.

[In]

Int[(a + b*Tan[c + d*x]^3)^2,x]

[Out]

(a^2 - b^2)*x + (2*a*b*Log[Cos[c + d*x]])/d + (b^2*Tan[c + d*x])/d + (a*b*Tan[c + d*x]^2)/d - (b^2*Tan[c + d*x
]^3)/(3*d) + (b^2*Tan[c + d*x]^5)/(5*d)

Rule 203

Int[((a_) + (b_.)*(x_)^2)^(-1), x_Symbol] :> Simp[(1*ArcTan[(Rt[b, 2]*x)/Rt[a, 2]])/(Rt[a, 2]*Rt[b, 2]), x] /;
 FreeQ[{a, b}, x] && PosQ[a/b] && (GtQ[a, 0] || GtQ[b, 0])

Rule 260

Int[(x_)^(m_.)/((a_) + (b_.)*(x_)^(n_)), x_Symbol] :> Simp[Log[RemoveContent[a + b*x^n, x]]/(b*n), x] /; FreeQ
[{a, b, m, n}, x] && EqQ[m, n - 1]

Rule 635

Int[((d_) + (e_.)*(x_))/((a_) + (c_.)*(x_)^2), x_Symbol] :> Dist[d, Int[1/(a + c*x^2), x], x] + Dist[e, Int[x/
(a + c*x^2), x], x] /; FreeQ[{a, c, d, e}, x] &&  !NiceSqrtQ[-(a*c)]

Rule 1810

Int[(Pq_)*((a_) + (b_.)*(x_)^2)^(p_.), x_Symbol] :> Int[ExpandIntegrand[Pq*(a + b*x^2)^p, x], x] /; FreeQ[{a,
b}, x] && PolyQ[Pq, x] && IGtQ[p, -2]

Rule 3661

Int[((a_) + (b_.)*((c_.)*tan[(e_.) + (f_.)*(x_)])^(n_))^(p_), x_Symbol] :> With[{ff = FreeFactors[Tan[e + f*x]
, x]}, Dist[(c*ff)/f, Subst[Int[(a + b*(ff*x)^n)^p/(c^2 + ff^2*x^2), x], x, (c*Tan[e + f*x])/ff], x]] /; FreeQ
[{a, b, c, e, f, n, p}, x] && (IntegersQ[n, p] || IGtQ[p, 0] || EqQ[n^2, 4] || EqQ[n^2, 16])

Rubi steps

\begin {align*} \int \left (a+b \tan ^3(c+d x)\right )^2 \, dx &=\frac {\operatorname {Subst}\left (\int \frac {\left (a+b x^3\right )^2}{1+x^2} \, dx,x,\tan (c+d x)\right )}{d}\\ &=\frac {\operatorname {Subst}\left (\int \left (b^2+2 a b x-b^2 x^2+b^2 x^4+\frac {a^2-b^2-2 a b x}{1+x^2}\right ) \, dx,x,\tan (c+d x)\right )}{d}\\ &=\frac {b^2 \tan (c+d x)}{d}+\frac {a b \tan ^2(c+d x)}{d}-\frac {b^2 \tan ^3(c+d x)}{3 d}+\frac {b^2 \tan ^5(c+d x)}{5 d}+\frac {\operatorname {Subst}\left (\int \frac {a^2-b^2-2 a b x}{1+x^2} \, dx,x,\tan (c+d x)\right )}{d}\\ &=\frac {b^2 \tan (c+d x)}{d}+\frac {a b \tan ^2(c+d x)}{d}-\frac {b^2 \tan ^3(c+d x)}{3 d}+\frac {b^2 \tan ^5(c+d x)}{5 d}-\frac {(2 a b) \operatorname {Subst}\left (\int \frac {x}{1+x^2} \, dx,x,\tan (c+d x)\right )}{d}+\frac {\left (a^2-b^2\right ) \operatorname {Subst}\left (\int \frac {1}{1+x^2} \, dx,x,\tan (c+d x)\right )}{d}\\ &=\left (a^2-b^2\right ) x+\frac {2 a b \log (\cos (c+d x))}{d}+\frac {b^2 \tan (c+d x)}{d}+\frac {a b \tan ^2(c+d x)}{d}-\frac {b^2 \tan ^3(c+d x)}{3 d}+\frac {b^2 \tan ^5(c+d x)}{5 d}\\ \end {align*}

________________________________________________________________________________________

Mathematica [C]  time = 0.52, size = 107, normalized size = 1.20 \[ \frac {30 a b \tan ^2(c+d x)-15 i \left ((a-i b)^2 \log (-\tan (c+d x)+i)-(a+i b)^2 \log (\tan (c+d x)+i)\right )+6 b^2 \tan ^5(c+d x)-10 b^2 \tan ^3(c+d x)+30 b^2 \tan (c+d x)}{30 d} \]

Antiderivative was successfully verified.

[In]

Integrate[(a + b*Tan[c + d*x]^3)^2,x]

[Out]

((-15*I)*((a - I*b)^2*Log[I - Tan[c + d*x]] - (a + I*b)^2*Log[I + Tan[c + d*x]]) + 30*b^2*Tan[c + d*x] + 30*a*
b*Tan[c + d*x]^2 - 10*b^2*Tan[c + d*x]^3 + 6*b^2*Tan[c + d*x]^5)/(30*d)

________________________________________________________________________________________

fricas [A]  time = 0.47, size = 85, normalized size = 0.96 \[ \frac {3 \, b^{2} \tan \left (d x + c\right )^{5} - 5 \, b^{2} \tan \left (d x + c\right )^{3} + 15 \, a b \tan \left (d x + c\right )^{2} + 15 \, {\left (a^{2} - b^{2}\right )} d x + 15 \, a b \log \left (\frac {1}{\tan \left (d x + c\right )^{2} + 1}\right ) + 15 \, b^{2} \tan \left (d x + c\right )}{15 \, d} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((a+b*tan(d*x+c)^3)^2,x, algorithm="fricas")

[Out]

1/15*(3*b^2*tan(d*x + c)^5 - 5*b^2*tan(d*x + c)^3 + 15*a*b*tan(d*x + c)^2 + 15*(a^2 - b^2)*d*x + 15*a*b*log(1/
(tan(d*x + c)^2 + 1)) + 15*b^2*tan(d*x + c))/d

________________________________________________________________________________________

giac [B]  time = 14.42, size = 1065, normalized size = 11.97 \[ \text {result too large to display} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((a+b*tan(d*x+c)^3)^2,x, algorithm="giac")

[Out]

1/15*(15*a^2*d*x*tan(d*x)^5*tan(c)^5 - 15*b^2*d*x*tan(d*x)^5*tan(c)^5 + 15*a*b*log(4*(tan(d*x)^4*tan(c)^2 - 2*
tan(d*x)^3*tan(c) + tan(d*x)^2*tan(c)^2 + tan(d*x)^2 - 2*tan(d*x)*tan(c) + 1)/(tan(c)^2 + 1))*tan(d*x)^5*tan(c
)^5 - 75*a^2*d*x*tan(d*x)^4*tan(c)^4 + 75*b^2*d*x*tan(d*x)^4*tan(c)^4 + 15*a*b*tan(d*x)^5*tan(c)^5 - 75*a*b*lo
g(4*(tan(d*x)^4*tan(c)^2 - 2*tan(d*x)^3*tan(c) + tan(d*x)^2*tan(c)^2 + tan(d*x)^2 - 2*tan(d*x)*tan(c) + 1)/(ta
n(c)^2 + 1))*tan(d*x)^4*tan(c)^4 - 15*b^2*tan(d*x)^5*tan(c)^4 - 15*b^2*tan(d*x)^4*tan(c)^5 + 150*a^2*d*x*tan(d
*x)^3*tan(c)^3 - 150*b^2*d*x*tan(d*x)^3*tan(c)^3 + 15*a*b*tan(d*x)^5*tan(c)^3 - 45*a*b*tan(d*x)^4*tan(c)^4 + 1
5*a*b*tan(d*x)^3*tan(c)^5 + 5*b^2*tan(d*x)^5*tan(c)^2 + 150*a*b*log(4*(tan(d*x)^4*tan(c)^2 - 2*tan(d*x)^3*tan(
c) + tan(d*x)^2*tan(c)^2 + tan(d*x)^2 - 2*tan(d*x)*tan(c) + 1)/(tan(c)^2 + 1))*tan(d*x)^3*tan(c)^3 + 75*b^2*ta
n(d*x)^4*tan(c)^3 + 75*b^2*tan(d*x)^3*tan(c)^4 + 5*b^2*tan(d*x)^2*tan(c)^5 - 150*a^2*d*x*tan(d*x)^2*tan(c)^2 +
 150*b^2*d*x*tan(d*x)^2*tan(c)^2 - 45*a*b*tan(d*x)^4*tan(c)^2 + 60*a*b*tan(d*x)^3*tan(c)^3 - 45*a*b*tan(d*x)^2
*tan(c)^4 - 3*b^2*tan(d*x)^5 - 25*b^2*tan(d*x)^4*tan(c) - 150*a*b*log(4*(tan(d*x)^4*tan(c)^2 - 2*tan(d*x)^3*ta
n(c) + tan(d*x)^2*tan(c)^2 + tan(d*x)^2 - 2*tan(d*x)*tan(c) + 1)/(tan(c)^2 + 1))*tan(d*x)^2*tan(c)^2 - 150*b^2
*tan(d*x)^3*tan(c)^2 - 150*b^2*tan(d*x)^2*tan(c)^3 - 25*b^2*tan(d*x)*tan(c)^4 - 3*b^2*tan(c)^5 + 75*a^2*d*x*ta
n(d*x)*tan(c) - 75*b^2*d*x*tan(d*x)*tan(c) + 45*a*b*tan(d*x)^3*tan(c) - 60*a*b*tan(d*x)^2*tan(c)^2 + 45*a*b*ta
n(d*x)*tan(c)^3 + 5*b^2*tan(d*x)^3 + 75*a*b*log(4*(tan(d*x)^4*tan(c)^2 - 2*tan(d*x)^3*tan(c) + tan(d*x)^2*tan(
c)^2 + tan(d*x)^2 - 2*tan(d*x)*tan(c) + 1)/(tan(c)^2 + 1))*tan(d*x)*tan(c) + 75*b^2*tan(d*x)^2*tan(c) + 75*b^2
*tan(d*x)*tan(c)^2 + 5*b^2*tan(c)^3 - 15*a^2*d*x + 15*b^2*d*x - 15*a*b*tan(d*x)^2 + 45*a*b*tan(d*x)*tan(c) - 1
5*a*b*tan(c)^2 - 15*a*b*log(4*(tan(d*x)^4*tan(c)^2 - 2*tan(d*x)^3*tan(c) + tan(d*x)^2*tan(c)^2 + tan(d*x)^2 -
2*tan(d*x)*tan(c) + 1)/(tan(c)^2 + 1)) - 15*b^2*tan(d*x) - 15*b^2*tan(c) - 15*a*b)/(d*tan(d*x)^5*tan(c)^5 - 5*
d*tan(d*x)^4*tan(c)^4 + 10*d*tan(d*x)^3*tan(c)^3 - 10*d*tan(d*x)^2*tan(c)^2 + 5*d*tan(d*x)*tan(c) - d)

________________________________________________________________________________________

maple [A]  time = 0.02, size = 108, normalized size = 1.21 \[ \frac {b^{2} \left (\tan ^{5}\left (d x +c \right )\right )}{5 d}-\frac {b^{2} \left (\tan ^{3}\left (d x +c \right )\right )}{3 d}+\frac {a b \left (\tan ^{2}\left (d x +c \right )\right )}{d}+\frac {b^{2} \tan \left (d x +c \right )}{d}-\frac {a b \ln \left (1+\tan ^{2}\left (d x +c \right )\right )}{d}+\frac {\arctan \left (\tan \left (d x +c \right )\right ) a^{2}}{d}-\frac {\arctan \left (\tan \left (d x +c \right )\right ) b^{2}}{d} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

int((a+b*tan(d*x+c)^3)^2,x)

[Out]

1/5*b^2*tan(d*x+c)^5/d-1/3*b^2*tan(d*x+c)^3/d+a*b*tan(d*x+c)^2/d+b^2*tan(d*x+c)/d-1/d*a*b*ln(1+tan(d*x+c)^2)+1
/d*arctan(tan(d*x+c))*a^2-1/d*arctan(tan(d*x+c))*b^2

________________________________________________________________________________________

maxima [A]  time = 0.92, size = 83, normalized size = 0.93 \[ a^{2} x + \frac {{\left (3 \, \tan \left (d x + c\right )^{5} - 5 \, \tan \left (d x + c\right )^{3} - 15 \, d x - 15 \, c + 15 \, \tan \left (d x + c\right )\right )} b^{2}}{15 \, d} - \frac {a b {\left (\frac {1}{\sin \left (d x + c\right )^{2} - 1} - \log \left (\sin \left (d x + c\right )^{2} - 1\right )\right )}}{d} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((a+b*tan(d*x+c)^3)^2,x, algorithm="maxima")

[Out]

a^2*x + 1/15*(3*tan(d*x + c)^5 - 5*tan(d*x + c)^3 - 15*d*x - 15*c + 15*tan(d*x + c))*b^2/d - a*b*(1/(sin(d*x +
 c)^2 - 1) - log(sin(d*x + c)^2 - 1))/d

________________________________________________________________________________________

mupad [B]  time = 11.60, size = 117, normalized size = 1.31 \[ \frac {b^2\,\mathrm {tan}\left (c+d\,x\right )}{d}-\frac {b^2\,{\mathrm {tan}\left (c+d\,x\right )}^3}{3\,d}+\frac {b^2\,{\mathrm {tan}\left (c+d\,x\right )}^5}{5\,d}+\frac {\mathrm {atan}\left (\frac {\mathrm {tan}\left (c+d\,x\right )\,\left (a+b\right )\,\left (a-b\right )}{a^2-b^2}\right )\,\left (a+b\right )\,\left (a-b\right )}{d}-\frac {a\,b\,\ln \left ({\mathrm {tan}\left (c+d\,x\right )}^2+1\right )}{d}+\frac {a\,b\,{\mathrm {tan}\left (c+d\,x\right )}^2}{d} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

int((a + b*tan(c + d*x)^3)^2,x)

[Out]

(b^2*tan(c + d*x))/d - (b^2*tan(c + d*x)^3)/(3*d) + (b^2*tan(c + d*x)^5)/(5*d) + (atan((tan(c + d*x)*(a + b)*(
a - b))/(a^2 - b^2))*(a + b)*(a - b))/d - (a*b*log(tan(c + d*x)^2 + 1))/d + (a*b*tan(c + d*x)^2)/d

________________________________________________________________________________________

sympy [A]  time = 0.60, size = 94, normalized size = 1.06 \[ \begin {cases} a^{2} x - \frac {a b \log {\left (\tan ^{2}{\left (c + d x \right )} + 1 \right )}}{d} + \frac {a b \tan ^{2}{\left (c + d x \right )}}{d} - b^{2} x + \frac {b^{2} \tan ^{5}{\left (c + d x \right )}}{5 d} - \frac {b^{2} \tan ^{3}{\left (c + d x \right )}}{3 d} + \frac {b^{2} \tan {\left (c + d x \right )}}{d} & \text {for}\: d \neq 0 \\x \left (a + b \tan ^{3}{\relax (c )}\right )^{2} & \text {otherwise} \end {cases} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((a+b*tan(d*x+c)**3)**2,x)

[Out]

Piecewise((a**2*x - a*b*log(tan(c + d*x)**2 + 1)/d + a*b*tan(c + d*x)**2/d - b**2*x + b**2*tan(c + d*x)**5/(5*
d) - b**2*tan(c + d*x)**3/(3*d) + b**2*tan(c + d*x)/d, Ne(d, 0)), (x*(a + b*tan(c)**3)**2, True))

________________________________________________________________________________________